package Demo01_15;

import java.util.ArrayList;

/**
 * Created by 14229 on 2020/1/16.
 */
public class Test13 {
    public static void main(String[] args) {

        Employee em1 = new Employee();
        em1.setName("小明");
        em1.setSalary(1800);
        Employee em2 = new Employee();
        em2.setName("小新");
        em2.setSalary(2600);

        ArrayList<Employee> list = new ArrayList<>();
        list.add(em1);
        list.add(em2);

        for (Employee emp : list) {
            if (emp.getName().equals("小明")){
                emp.setSalary(emp.getSalary()+300);
            }
            System.out.println(emp);
        }

    }
}
